package pl.mmadej.ds4java.ds.stack;


import pl.mmadej.ds4java.ds.common.DataStructure;
import pl.mmadej.ds4java.ds.list.LinkedList;

public class LinkedListStack<T> extends DataStructure<T> implements Stack<T> {

    private LinkedList<T> list = new LinkedList<T>();

    @Override
    public T pop() {
        return list.deleteLast();
    }

    @Override
    public void push(T t) {
        list.insert(t);
    }

    @Override
    public T top() {
        return list.searchLast();
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public boolean empty() {
        return list.empty();
    }

    @Override
    public void clear() {
        list.clear();
    }

    @Override
    public void reverse() {
        list.reverse();
    }


}
